import HomePage from '@/pages/HomePage.vue'
import UserLoginPage from '@/pages/user/UserLoginPage.vue'
import UserRegisterPage from '@/pages/user/UserRegisterPage.vue'
import UserManagePage from '@/pages/admin/UserManagePage.vue'
import ACCESS_ENUM from '@/access/accessEnum'
import type { RouteRecordRaw } from 'vue-router'
import UserLayout from '@/layouts/UserLayout.vue'
import TagManagePage from '@/pages/admin/TagManagePage.vue'
import ScenicManagePage from '@/pages/admin/ScenicManagePage.vue'
import RouteManagePage from '@/pages/admin/RouteManagePage.vue'
import ScenicPage from '@/pages/ScenicPage.vue'
import RoutePage from '@/pages/RoutePage.vue'

export const routes: Array<RouteRecordRaw> = [
  {
    path: '/user',
    name: '用户',
    component: UserLayout,
    children: [
      {
        path: 'login',
        name: '用户登录',
        component: UserLoginPage,
      },
      {
        path: 'register',
        name: '用户注册',
        component: UserRegisterPage,
      },
    ],
    meta: {
      hideinmenu: true,
    },
  },
  {
    path: '/',
    name: '主页',
    component: HomePage,
  },
  {
    path: '/scenic',
    name: '仙人洞景点',
    component: ScenicPage,
  },
  {
    path: '/route',
    name: '仙人洞游玩线路',
    component: RoutePage,
  },
  {
    path: '/admin/userManage',
    name: '用户管理',
    component: UserManagePage,
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },
  {
    path: '/admin/tagManage',
    name: '标签管理',
    component: TagManagePage,
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },
  {
    path: '/admin/scenicManage',
    name: '景点管理',
    component: ScenicManagePage,
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },
  {
    path: '/admin/routeManage',
    name: '路线管理',
    component: RouteManagePage,
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },
  {
    path: '/about',
    name: '关于仙人洞',
    // route level code-splitting
    // this generates a separate chunk (About.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import('@/pages/AboutView.vue'),
    meta: {
      access: ACCESS_ENUM.USER,
    },
  },
]
